package com.chhuang.utils.executor;
/**
 * 
 * @author 黄晨
 *
 */
public class Resycle implements Runnable{

	private TokenFactory factory;
	private long resycleTime;
	
	public Resycle(TokenFactory factory, long resycleTime) {
		this.factory=factory;
		this.resycleTime=resycleTime;
	}

	public void run() {
		while(true){
			factory.createToken();
			try {
				Thread.sleep(resycleTime);
			} catch (InterruptedException e) {
				e.printStackTrace();
				factory.setResycle(null);
				break;
			}
		}
	}

}
